package com.Homework3;

import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;

public class Test02 {
    public static void main(String[] args) {
        HashSet<Student> hashSet1 = new HashSet<>();
        Student s1 = new Student("张三1", 12);
        Student s2 = new Student("张三2", 13);
        Student s3 = new Student("张三3", 14);
        HashSet<Student> hashSet2 = new HashSet<>();
        Student s4 = new Student("张三4", 12);
        Student s5 = new Student("张三5", 13);
        Student s6 = new Student("张三6", 14);
        Collections.addAll(hashSet1,s1,s2,s3);
        Collections.addAll(hashSet2,s4,s5,s6);
        HashSet<HashSet<Student>> subject = new HashSet<>();
       Collections.addAll(subject,hashSet1,hashSet2);
        for (HashSet<Student> students : subject) {
            System.out.println(students+" ");
        }
        Iterator<HashSet<Student>> iterator = subject.iterator();
        while (iterator.hasNext()){
            HashSet<Student> next = iterator.next();
            System.out.println(next+" ");
        }

    }
}
